<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/common/template.xhtml">

	<ui:define name="headSection">

	</ui:define>

	<ui:define name="pageContent">
		<h:form>
			<table class="mainTable">
				<tr>
					<td><h:outputLabel value="Име*">
							<br />
							<h:inputText id="name"
								value="#{dobavqneNaPotrebitel.employeeName}" maxlength="50"
								readonly="true" />
						</h:outputLabel></td>
					<td><h:outputLabel value="Фамилия*">
							<br />
							<h:inputText id="family"
								value="#{dobavqneNaPotrebitel.employeeFamily}" maxlength="50"
								readonly="true" />
						</h:outputLabel></td>
					<td><h:commandButton
							action="#{dobavqneNaPotrebitel.chooseEmployee()}"
							value="Избери служител" class="regButton"
							style="width:150px;height:40px;margin-left:20px;margin-top: 15px;" />
					</td>
				</tr>
				<tr>
					<td><h:outputLabel value="Автосервиз*"
							style="width:200px;height:48px;text-align:center;">
							<br />
							<h:selectOneMenu value="#{dobavqneNaPotrebitel.autoserviceID}">
								<f:selectItems value="#{dobavqneNaPotrebitel.autoservices}"
									var="currentAutoservice" itemLabel="#{currentAutoservice.name}"
									itemValue="#{currentAutoservice.ID}" />
							</h:selectOneMenu>
						</h:outputLabel></td>
					<td><h:outputLabel value="Потребителско име*">
							<br />
							<h:inputText id="username"
								value="#{dobavqneNaPotrebitel.username}" maxlength="50"
								required="#{not empty param[dobavqneNaPotrebitel.addButton.clientId]}"
								requiredMessage="задължително поле!"
								validatorMessage="Потребителското име може да съдържа само латински букви, цифри, тире и подчертаващо тире и да бъде от 3 до 50 символа.">
								<f:validateRegex pattern="^[a-zA-Z0-9_\-]{3,50}$" />
							</h:inputText>
							<br />
							<h:message for="username" class="errorMsg" />
						</h:outputLabel></td>
					<td><h:outputLabel value="Позиция*"
							style="width:200px;height:48px;text-align:center;">
							<h:selectOneMenu value="#{dobavqneNaPotrebitel.position}">
								<f:selectItems value="#{dobavqneNaPotrebitel.positions}" />
							</h:selectOneMenu>
						</h:outputLabel></td>
				</tr>
				<tr>
					<td><h:commandButton
							binding="#{dobavqneNaPotrebitel.addButton}"
							action="#{dobavqneNaPotrebitel.writeIt()}" value="Добави"
							class="regButton"
							style="width:80px;height:40px;margin-left:20px;" />
						<br/>
						<h:outputText value="#{dobavqneNaPotrebitel.errorMessage}" />
					</td>
				</tr>
			</table>
		</h:form>

	</ui:define>

</ui:composition>
</html>